package com.iflytek.crvoice2txt.application;

import android.app.Application;
import android.content.Context;

import com.iflytek.cloud.SpeechUtility;
import com.iflytek.crvoice2txt.R;
import com.iflytek.crvoice2txt.util.PermissionUtil;

import io.realm.Realm;
import io.realm.RealmConfiguration;

public class MyApplication extends Application {

    private static MyApplication instance = null;

    @Override
    public void onCreate() {
        SpeechUtility.createUtility(MyApplication.this, "appid=" + getString(R.string.app_id));
        super.onCreate();
        instance=this;
        Realm.init(this);
        RealmConfiguration config = new  RealmConfiguration.Builder()
                .name("myRealm.realm")
                .deleteRealmIfMigrationNeeded()
                .build();
        Realm.setDefaultConfiguration(config);
    }

    public static Context getContext(){
        return instance.getApplicationContext();
    }

}
